<template>
<!-- 轮播图 -->
  <div class="swiperTop">
    <van-swipe :autoplay="3000" lazy-render>
      <van-swipe-item v-for="image in state.images" :key="image">
        <img :src="image.pic" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>
<script>
import { getBanner } from "@/Api/API";
import { reactive, onMounted } from "vue";
export default {
  setup() {
    const state = reactive({
      images: [
        // "https://img.yzcdn.cn/vant/apple-1.jpg",
      ],
    });
    onMounted(async () => {
      let res = await getBanner();
      state.images=res.data.banners
    });
    return { state };
  },
};
</script>
<style lang="less" scoped>
.swiperTop {
  .van-swipe {
    width: 100%;
    height: 3rem;
    overflow: hidden;
   /deep/ .van-swipe__track{
        display: flex;
    }
    .van-swipe-item {
      padding: 0 0.2rem;
      img {
        width: 100%;
        height: 100%;
        border-radius: 0.2rem;
      }
    }
  }
} 
</style>